<b class="b1h"></b><b class="b2h"></b><b class="b3h"></b><b class="b4h"></b>
    <div class="headh">
        <h3>Stage 1</h3>
    </div>
    <div class="contenth">
        <div>
		First we need to check see if our image directories are writable to allow product, category, banner and brand image upload.
		<ul>
			<?php 
			    $err_array = array();
				fcflush();
				echo "<li>Checking ../images/banner ";
				if (is_writable("../images/banner/")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/banner/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/cat ";
				if (is_writable("../images/cat/")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/cat/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/Catalog ";
				if (is_writable("../images/Catalog/")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/Catalog/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/Catalog/big ";
				if (is_writable("../images/Catalog/big")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/Catalog/big/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/Catalog/th ";
				if (is_writable("../images/Catalog/th")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/Catalog/th/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/ideas ";
				if (is_writable("../images/ideas/")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/ideas/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/ideas/th ";
				if (is_writable("../images/ideas/th")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/ideas/th/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/manuf ";
				if (is_writable("../images/manuf")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/manuf/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/product ";
				if (is_writable("../images/product")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/images/product/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/product/big ";
				if (is_writable("../images/product/big")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/product/big/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
				clearstatcache();
				echo "<li>Checking ../images/product/midium ";
				if (is_writable("../images/product/midium")) {
					echo "<span style=\"color:green\">OK</span>";
					$ok = 1;
				} else {
					echo '<span style=\"color:#FF0000\">FAIL</span>';
					$err_array[] = "../images/product/midium/";
					$ok = 0;
				}
				echo "</li>";
				fcflush();
			?>
		</ul>
		<?php
			if ($ok==0) {
				echo "Some of the required directories were not writable.  Attempting to automaticallly fix the issue";
				echo "<ul>";
				for ($i=0;$i<=count($err_array);$i++) {
					echo "<li>".$err_array[$i];
						if (chmod($err_array[$i], 0777)) {
							$ok = 1;
							echo "<span style=\"color:green\">Resolved</span>";
							fcflush();
						} else {
							$ok = 0;
							echo "<span style=\"color:#FF0000\">FAILED</span>";
							fcflush();
						}
					echo "</li>";
				}
				echo "</ul>";
			} 
			
			if ($ok==0) {
				echo "We could not automatically fix the directory permissions<br /><br />Please connect to your web host using an FTP client.<br />Find each of the folders listed above and change their permissions/attributes to 777<br /><br />After you have done that please refresh this page";
			}
		?>
		<br />
		</div>
    </div>
<b class="b4bh"></b><b class="b3bh"></b><b class="b2bh"></b><b class="b1h"></b>
<?php if ($ok==1) { ?>
<a href="index.php?p=2"><img src="next.png" border="0" align="right" /></a>
<?php } ?>
